package offer;

public class offer65 {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int a = solution.add(20,17);
        System.out.println(a);
    }

    static class Solution {
        public int add(int a, int b) {
            while(b != 0) { // 当进位为 0 时跳出
                int c = (a & b) << 1;  // c = 进位
                a ^= b; // a = 非进位和
                b = c; // b = 进位
            }
            return a;
        }
    }
}
